package com.design.responsibility.demo2;

// 文件日志处理器
class FileLogHandler implements LogHandler {
    private LogHandler nextHandler;

    @Override
    public void setNextHandler(LogHandler nextHandler) {
        this.nextHandler = nextHandler;
    }

    @Override
    public void handleLog(String message, LogLevel logLevel) {
        if (logLevel == LogLevel.FILE) {
            System.out.println("File Log: " + message);
        } else if (nextHandler != null) {
            nextHandler.handleLog(message, logLevel);
        }
    }
}
